﻿[File_ProcessUploads: $CMS_site_upload_path, -FileOverwrite]

<html>
<head>
    <title>Image Selector</title>
    
    <script language="javascript" type="text/javascript" src="[$CMS_site_path]templates/[$CMS_template]/js/tiny_mce/tiny_mce_popup.js"></script>
    <script language="javascript" type="text/javascript" src="[$CMS_site_path]templates/[$CMS_template]/js/tiny_mce/plugins/imgselector/js/imgselector.js"></script>

    <script type="text/javascript">
        function SelectImage(obj) {
            document.getElementById('selected_image').value = obj.name;
            ImgSelectorDialogue.mySubmit();
        }
    </script>

</head>

<body>

	[$txt_imgsel_intro]<br/><br/>

    <form name="frm_img_selector" id="frm_img_selector">
    	<input type="hidden" name="selected_image" id="selected_image" value="" />
    </form>

    <form name="frm_img_upload" action="[Response_FilePath]?f=imgselector" method="post" enctype="multipart/form-data">
        <input type="file" name="upload" id="upload"> <input type="submit" name="cmdSubmit" id="cmdSubmit" value="[$txt_imgsel_upload]">
    </form>


	<table border="0">
		<tr>
			[var:'files'=(File_ListDirectory: $CMS_site_upload_path)]
			[Iterate: $files, (Variable:'item')]
				[If: (Loop_Count % 7) == 1]</tr><tr>[/if]
					<td valign="bottom" align="center">
						[var:'img_src'=($CMS_site_upload_path) + '/' + ($item)]
						[var:'img_src_img'=(Image: $img_src)]
						<img name="[$img_src]" src="[$CMS_site_path]templates/[$CMS_template]/image.lasso?img=[$img_src]" onClick="SelectImage(this);" title="[$txt_imgsel_tooltip]" /><br /><br />
						[$img_src_img->Format]<br/>[$img_src_img->Width] x [$img_src_img->Height] px<br /><br />
					</td>
			[/Iterate]
		</tr>
    </table>
    
</body>
</html>